/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasUserCusPerson extends BasicModel<BasUserCusPerson> {
  userCode?: string; // 用户
  cusCode?: string; // 客户
}

export const basUserCusPersonList = (params?: BasUserCusPerson | any) =>
  defHttp.get<BasUserCusPerson>({ url: adminPath + '/bas/cus/basUserCusPerson/list', params });

export const basUserCusPersonListData = (params?: BasUserCusPerson | any) =>
  defHttp.post<Page<BasUserCusPerson>>({
    url: adminPath + '/bas/cus/basUserCusPerson/listData',
    params,
  });

export const basUserCusPersonForm = (params?: BasUserCusPerson | any) =>
  defHttp.get<BasUserCusPerson>({ url: adminPath + '/bas/cus/basUserCusPerson/form', params });

export const basUserCusPersonSave = (params?: any, data?: BasUserCusPerson | any) =>
  defHttp.postJson<BasUserCusPerson>({
    url: adminPath + '/bas/cus/basUserCusPerson/save',
    params,
    data,
  });

export const basUserCusPersonImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bas/cus/basUserCusPerson/importData',
      onUploadProgress,
    },
    params,
  );

export const basUserCusPersonDelete = (params?: BasUserCusPerson | any) =>
  defHttp.get<BasUserCusPerson>({ url: adminPath + '/bas/cus/basUserCusPerson/delete', params });

export const basUserCusPersonBatchDelete = (params?: BasUserCusPerson | any) =>
  defHttp.get<BasUserCusPerson>({
    url: adminPath + '/bas/cus/basUserCusPerson/batchDelete',
    params,
  });

  export const basUserCusPersonTreeData = (params?: BasUserCusPerson | any) =>
    defHttp.post<BasUserCusPerson>({ url: adminPath + '/bas/cus/basUserCusPerson/treeData', params });
